﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>登录系统</title>
    <script language="javascript" type="text/javascript">
        javascript: window.history.forward(1); 
    </script>
    <link rel="stylesheet" type="text/css" href="../resources/css/ext-all.css" />
    <script type="text/javascript" src="../scripts/ext-all.js"></script>
    <script type="text/javascript" src="../scripts/ext-lang-zh_CN.js"></script>
    <style type="text/css">
        a.style1:link, a.style1:active, a.style1:visited, a.style1:hover
        {
            font-weight: bold;
            font-size: 18px;
        }
        .dl_bg
        {
            background-image: url(images/dl_bgNew.jpg);
            background-repeat: no-repeat;
            width: 574px;
            height: 307px;
        }
        .tb_bg
        {
            background-image: url(images/dl_bg.jpg);
            background-repeat: no-repeat;
            width: 1003px;
            height: 100%;
        }
    </style>
    <script language="javascript" type="text/javascript">
        Ext.BLANK_IMAGE_URL = '../../Scripts/Ext3.2.0/resources/images/default/s.gif';
        Ext.onReady(function () {
            Ext.QuickTips.init();
            var btnLogin = new Ext.Button({
                text: '登录',
                handler: function () {
                    var vauleObj = formLoginSystem.getValues();
                    Ext.Ajax.request({
                        waitMsg: '登录中,请稍候...',
                        url: '../HotelWebService.asmx/LoginSystem',
                        success: function (response, opts) {
                            eval('var result =' + response.responseText + ';');
                            {
                                if (result.success) {
                                    g_user = vauleObj.UserName;
                                    window.location.href = 'admin/index.html';
                                }
                                else {
                                    Ext.Msg.alert(AdviceLang.AlertInfo, AdviceLang.UserOrPasswordError);
                                }
                            }
                        },
                        failure: function (response, opts) {
                            Ext.Msg.alert(AdviceLang.AlertInfo, AdviceLang.LoginFailed);
                        },
                        params: { userName: vauleObj.UserName, password: vauleObj.Password }
                    });
                }
            });

            var required = '<span style="color:red;font-weight:bold" data-qtip="Required">*</span>';

            var formLoginSystem = new Ext.FormPanel({
                baseCls: 'x-plain',
                labelAlign: 'left',
                labelWidth: 70,
                renderTo: 'divForm',
                bodyStyle: 'padding:40 0 10 135',
                buttonAlign: 'center',
                url: '../HotelWebService.asmx/LoginSystem',
                defaultType: 'textfield',
                standardSubmit: true,
                keys: [{
                    key: [13],
                    fn: function () {
                        //var form = this.up('form').getForm();
                        var vauleObj = formLoginSystem.getValues();
                        Ext.Ajax.request({
                            url: '../HotelWebService.asmx/LoginSystem',
                            success: function (response, opts) {
                                eval('var result =' + response.responseText + ';');
                                {
                                    if (result.success) {
                                        g_user = vauleObj.UserName;
                                        window.location.href = 'desktop/desktop.html';
                                    }
                                    else {
                                        Ext.Msg.alert(AdviceLang.AlertInfo, AdviceLang.UserOrPasswordError);
                                    }
                                }
                            },
                            failure: function (response, opts) {
                                Ext.Msg.alert(AdviceLang.AlertInfo, AdviceLang.LoginFailed);
                            },
                            params: { userName: vauleObj.UserName, password: vauleObj.Password }
                        });
                    },
                    scope: this
                }],
                items: [
                    { fieldLabel: '用户名', afterLabelTextTpl: required, allowBlank: false, name: 'UserName', width: 300 },
                    { fieldLabel: '密码', afterLabelTextTpl: required, name: 'Password', allowBlank: false, inputType: 'password', width: 300 }
                ],
                buttons: [btnLogin]
            });
        });
    
    </script>
</head>
<body style="background: #92bffa url(images/b_bg1.jpg); background-repeat: repeat-x;">
    <table width="1003" border="0" align="center" cellpadding="0" cellspacing="0" class="tb_bg">
        <tr>
            <td width="471" valign="top">
                <table width="1003" height="637" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td width="215" height="149">
                            &nbsp;
                        </td>
                        <td width="613" height="149">
                            &nbsp;
                        </td>
                        <td width="214" height="149">
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td height="307">
                            &nbsp;
                        </td>
                        <td width="574" align="left" valign="middle" class="dl_bg">
                            <div style="height: 150px; margin-top: 30px" id="divForm">
                            </div>
                            <div class="bq" style="text-align: center; margin-top: 20px">
                            </div>
                        </td>
                        <td height="307">
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td height="155">
                            &nbsp;
                        </td>
                        <td height="155">
                            &nbsp;
                        </td>
                        <td height="155">
                            &nbsp;
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</body>
</html>
